package com.zzl.springboot_mybatis_demo.controller.rest;

import com.gitee.yongzhuzl.commonutil.util.map.MapUtil;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * Description：rest服务
 * Created by 朱正磊 on 2019-08-18 21:46
 */
@RequestMapping("/api/rest")
@RestController
public class MyRestController {

    @GetMapping("/getInfo/{name}")
    public Object getInfo(@PathVariable String name) {
        Map<String, Object> data = new HashMap<>();
        data.put("name", name);
        return data;
    }

    @PostMapping("/postInfo")
    public Object postInfo(HttpServletRequest request) {
        Map<String, Object> paramsMap = MapUtil.getParamsMap(request);
        System.out.println(paramsMap);
        return paramsMap;
    }

}
